﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LaoLuo
{
    public class CircularList<T> : List<T>
    {
        public CircularList()
            :base()
        {

        }

        public CircularList(IEnumerable<T> collection)
            :base(collection)
        {
        }

        public CircularList(params T[] collection)
            :this(collection.AsEnumerable())
        {

        }

        public new T this[int index]
        {
            get
            {
                return base[index % this.Count];
            }
            set
            {
                base[index % this.Count] = value;
            }
        }
    }
}
